<%@ page import="javax.servlet.jsp.JspWriter" pageEncoding="utf-8"%>
<%@ page import="com.flute.haflute.monitor.ClusterStatusMonitor"%>
<%@ page import="com.flute.haflute.monitor.UniversalMonitorMsg"%>
<%@ page import="com.flute.haflute.monitor.UniversalMsgComparetor"%>
<%@ page import="com.flute.haflute.monitor.StatusMessage"%>
<%@ page language="java" import="java.util.*" %>
<%
String path = request.getContextPath();
String ip = request.getParameter("ip");
if(ip!=null&&ip.equalsIgnoreCase("null")){
	  ip = null;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>监控列表</title>
<link href="<%=path%>/css/admin.css" rel="stylesheet" type="text/css"/>
<link href="<%=path%>/css/pub.css" rel="stylesheet" type="text/css"/>
<script language="javascript" type="text/javascript" src="<%=path%>/js/sort.js"></script>
</head>
<body>
<!--heaer start-->
<div class="header"><img src="images/SystemName.gif" /></div>
<!--heaer end-->
<!--content start-->
<div class="content">
        <jsp:include page="/page/left_menu_admin.jsp" />
        <div class="right"> 
        <div class="title">监控列表:</div>
		<table width="940" border="0" cellspacing="1" class="sortable" id="mytable" >
		  <tr  class="h_tr">
			<td width="150" height="18" bgcolor="#f3f5f8">节点</td>
			<td width="180" bgcolor="#f3f5f8">模块</td>
			<td width="150">主题</td>
			<td width="200">内容</td>
			<td width="100" bgcolor="#f3f5f8">说明</td>
			<td width="160" bgcolor="#f3f5f8">汇报时间</td>
		  </tr>
		  <%
		    List<UniversalMonitorMsg> list = ClusterStatusMonitor.getReceiveStatusMessage(ip);
            Collections.sort(list,new UniversalMsgComparetor());
     
			Iterator<UniversalMonitorMsg> it =list.iterator();
			while(it.hasNext()){
				UniversalMonitorMsg universalMsg = it.next();
				if(ip!=null){
					if(ip.equals(universalMsg.getIp())){
						
          %>
		  <tr>
	        <td align='left'><%=universalMsg.getIp()%></td>
	        <td align='left'><%=universalMsg.getMoudle()%></td>
	        <td align='left'><%=universalMsg.getStatusMsg().topic%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().content%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().explanation==null?"-":universalMsg.getStatusMsg().explanation%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().reportDate%></td>
	    </tr>
    <%
					}
        	}else{
        		%>
        		
        <tr>
	        <td align='left'><%=universalMsg.getIp()%></td>
	        <td align='left'><%=universalMsg.getMoudle()%></td>
	        <td align='left'><%=universalMsg.getStatusMsg().topic%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().content%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().explanation==null?"-":universalMsg.getStatusMsg().explanation%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().reportDate%></td>
	    </tr>
        		<% 
        	}
		}
        	
        %>	   
	  </table>
	   <div class="title"><input class="button" type="button" value="刷新" onClick="window.location='<%=request.getContextPath()%>/monitorparamlist.jsp?ip=<%=ip %>'" /></div>
  </div>
  </div>
  <div class="footer"></div>
  </body>
  </html>